import request from "./request";

export default {
  indexArticlebyOne(articleId) {
    return request({
      method: 'get',
      url: `/blogfbk/articles/article/clear/${articleId}`
    })
  },
  indexArticle(userId,articleNumber) {
    return request({
      method: 'get',
      url: `/blogfbk/articles/article/clear/${userId}/${articleNumber}`,
    })
  },
  indexArticleFind(tagOrCategory,articleNumber,userId){
    return request({
      method: 'get',
      url: `/blogfbk/articles/article/clear/${tagOrCategory}/${articleNumber}/${userId}`,
    })
  },
  getAllArticleAndTag() {
    return request({
      method: 'get',
      url: 'blogfbk/writearticle/findall'
    })
  },
  uploadImg(file){
    return request({
      method:'post',
      url:'ossimage/fbk/oss/upload',
      data:{
        file
      },
      headers:{
        'Content-Type':'multipart/form-data'
      }
    })
  },
  uploadBackgroundImg(data){
    return request({
      method:'post',
      url:'ossimage/fbk/oss/upload',
      data:{
        data
      }
    })
  },
  getAllCategory(){
    return request({
      method:'get',
      url:'blogfbk/articlecategory/getall'
    })
  },
  getAllTag(){
    return request({
      method:'get',
      url:'blogfbk/articletag/getall'
    })
  },
  getMyArticle(userId){
    return request({
      url:`blogfbk/writearticle/findmyarticle/${userId}`,
      method:'get',
    })
  },
  updateArticleViewCount(articleId){
    return request({
      url:`blogfbk/writearticle/update/articleViewCount/${articleId}`,
      method:'get',
    })
  },
  byCategoryGetTag(categoryId){
    return request({
      url:`blogfbk/articlecategory/getTagById/${categoryId}`,
      method:'get'
    })
  },
  publishArticle(userId,category,tagList,title,content){
    return request({
      url:`blogfbk/writearticle/publish/${userId}`,
      method:'post',
      data:{
       category,
       tagList,
       title,
       content
      }
    })
  },
  findArticleComment(articleId){
    return request({
      url:`blogfbk/comment/findComment/${articleId}`,
      method:'get'
    })
  },
  commentArticle(articleId,userId,content,commentId){
    return request({
      url:'blogfbk/comment/commentArticle',
      method:'post',
      data:{
        articleId,
        userId,
        content,
        commentId
      }
    })
  },
  GetBackGroundImg(userId){
    return request({
      url:`blogfbk/backgroundimg/get/${userId}`,
      method:'get'
    })
  },
  SaveBackGroundimg(userId,backgroundImg){
    return request({
      url:`blogfbk/backgroundimg/save/${userId}`,
      params:{
        backgroundImg
      }
    })
  },
  addCategory(content){
    return request({
      url:'blogfbk/articlecategory/addCategory',
      params:{
        content
      },
      method:'get'
    })
  },
  findAllArticleNumber(){
    return request({
      url:'blogfbk/articles/findAllArticleNumber',
      method:'get'
    })
  },
  findOneUserArticle(userId){
    return request({
      url:`blogfbk/articles/article/findOneUserArticle/${userId}`,
      method:'get'
    })
  },
  getSearchArticle(content){
    return request({
      url:'blogfbk/articles/aritcle/searchArticle',
      method:'get',
      params:{
        content
      }
    })
  }
}